<template>
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="orange">
    <van-swipe-item v-for="item in bannerImgs" :key="item.bannerid">
      <img :src="item.img" class="banner-imgs" />
    </van-swipe-item>
  </van-swipe>
</template>

<script>
import { getBannerApi } from "@/api/banner";
export default {
  name: "HomeSwiper",
  data() {
    return {
      bannerImgs: [],
    };
  },
  methods: {
    async getBanner() {
      let res = await getBannerApi();
      if (res.data.code == 200) {
        this.bannerImgs = res.data.data;
      }
    },
  },
  mounted() {
    this.getBanner();
  },
};
</script>

<style scoped>
.my-swipe .van-swipe-item {
  color: orange;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
  height: 1.5rem;
  /* width: 100%; */
}
.banner-imgs {
  width: 100%;
  height: 100%;
}
</style>
